import {reactive} from "vue"
import {Constant} from "../../../../utils/constant";
import $button from "@/button";

export const tableItem = reactive({
    select: false,
    index: false,
    tree: true,
    expandAll: true,
    align: 'center',
    column: [
        {
            label: '订单号',
            prop: 'orderCode'
        },
        {
            label: '订单类型',
            prop: 'enterpriseFlag',
            htmlContent: (row)=>{
                return row.enterpriseFlag == 1 ? '企业' : '个人'
            }
        },
        {
            label: '用户',
            prop: 'payUserName'
        },
        {
            label: '销售',
            prop: 'saleName'
        },
        {
            label: '支付金额',
            prop: 'payPrice'
        },
        {
            label: '订单状态',
            prop: 'orderStatus',
            htmlContent: (row)=>{
                let status = row.orderStatus
                let statusName = Constant.orderStatusMap[status]
                return statusName
            }
        },
        {
            label: '下单时间',
            prop: 'createTime'
        },
        {
            label: '支付时间',
            prop: 'payTime'
        },
        {
            label: '操作',
            prop: 'action'
        },
    ],
    pageInfo: {
        request: {
            pageDomain:{}
        },
        pagesClose: false,//是否开启分页
        url: '/admin/order/paging',//分页路由，不传的话需要传入自定义的分页函数paging 传入时定义的分页函数paging会失效
    },
    // 分页数据 自定义分页函数paging时需要把值赋给tableData
    tableData: {
        total: 10,//分页总计
        // 分页数据
        data: []
    },
    // 操作栏按钮
    btnArray: [
        // {
        //     type: 'primary',//类别
        //     code: 'detail',
        //     label: '详情',
        // },
        {
            type: 'primary',//类别
            label: '修改',
            code: 'edit',
        }
    ],
})

// 名称、课程大类、有效期、是否有活动、上架状态

export const operationItem = reactive({
    defaultSearch: true,//默认搜索按钮
    defaultRefresh: true,//默认重置按钮
    customTableHeader: false,//

    // 封面、名称、课程大类、销量、标签、特色（多选）、有效期、上架状态、是否有活动（待定）、创建时间
    SearchItem: [
        {
            code: 'payUserName',
            name: '用户',
            type: 'input',
        },
        {
            code: 'orderStatus',
            name: '订单状态',
            type: 'select',
            placeholder: '请选择订单状态',
            options: Constant.orderStatusList,
            label: 'name',
            value: 'code'
        }
    ],
    menuArray: [
        {
            show: true,
            code: 'add',
            type: 'primary',
            text: '新增'
        }, {
            show: true,
            code: 'inducts',
            type: 'primary',
            hasPermi: [$button.personpersonexport || null],
            text: '导入',
            handle: () => {
            }
        },
    ]
})
